/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 * Description: cfi driver Vendor Hooks
 */

#ifdef CONFIG_NETBIOS_CFI_SPEC

#if !defined(CFI_CMDSET_0002_EXT_H) || defined(TRACE_HEADER_MULTI_READ)
#define CFI_CMDSET_0002_EXT_H
#include <linux/mtd/mtd.h>
void trace_cfi_statistic_erase_optime(int errno, unsigned long adr, struct timespec64 *ti, struct timespec64 *to);
void trace_cfi_statistic_write_optime(int errno, unsigned long adr, struct timespec64 *ti, struct timespec64 *to);
int trace_cfi_get_flash_blocknum(resource_size_t phys, unsigned long size, unsigned long addr);
void trace_cfi_flash_errinfo_obj_exit(void);
void trace_cfi_update_write_counter(int errno, int arg);
void trace_cfi_update_erase_counter(int errno, int arg);
void trace_cfi_update_read_counter(int errno, int arg);
void trace_cfi_flash_errinfo_obj_init(void);
void trace_cfi_info_init(struct cfi_private *cfi);
int trace_cfi_err_info_setup(struct mtd_info *mtd);
#endif

#else

#include <linux/tracepoint.h>
struct mtd_info;
struct cfi_private;

DECLARE_EVENT_NOP(cfi_statistic_erase_optime,
	TP_PROTO(int errno, unsigned long adr, struct timespec64 *ti, struct timespec64 *to),
	TP_ARGS(errno, adr, ti, to));

DECLARE_EVENT_NOP(cfi_statistic_write_optime,
	TP_PROTO(int errno, unsigned long adr, struct timespec64 *ti, struct timespec64 *to),
	TP_ARGS(errno, adr, ti, to));

static inline int trace_cfi_get_flash_blocknum(resource_size_t phys, unsigned long size, unsigned long addr)
{
	return 0;
}

DECLARE_EVENT_NOP(cfi_flash_errinfo_obj_exit,
	TP_PROTO(void),
	TP_ARGS());

DECLARE_EVENT_NOP(cfi_update_write_counter,
	TP_PROTO(int errno, int arg),
	TP_ARGS(errno, arg));

DECLARE_EVENT_NOP(cfi_update_erase_counter,
	TP_PROTO(int errno, int arg),
	TP_ARGS(errno, arg));

DECLARE_EVENT_NOP(cfi_update_read_counter,
	TP_PROTO(int errno, int arg),
	TP_ARGS(errno, arg));

DECLARE_EVENT_NOP(cfi_flash_errinfo_obj_init,
	TP_PROTO(void),
	TP_ARGS());

DECLARE_EVENT_NOP(cfi_info_init,
	TP_PROTO(struct cfi_private *cfi),
	TP_ARGS(cfi));

static inline int trace_cfi_err_info_setup(struct mtd_info *mtd)
{
	return 0;
}
#endif


